package com.mobimagic.lockscreen.view;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.mobimagic.lockscreen.Charge;
import com.mobimagic.lockscreen.R;

public class ChargingTipsCard extends LinearLayout {

    private Charge mCharge;
    public ChargingTipsCard(Context context, Charge charge) {
        super(context);
        mCharge = charge;
        View.inflate(context, R.layout.mobile_charge_tip_layout, this);
        initView();
    }

    private void initView() {
        TextView tipTitle = (TextView) findViewById(R.id.tips_title);
        float value = mCharge.getChargingValue();
        if (value == 1) {
            tipTitle.setText(R.string.battery_full_tip_title);
        } else if (value < 1) {
            if (mCharge.isCharging()) {
                tipTitle.setText(R.string.battery_is_charging_tip_title);
            } else {
                tipTitle.setText(R.string.battery_not_full_tip_title);
            }
        }
    }

}
